import { NextRequest, NextResponse } from 'next/server';
import { cookies } from 'next/headers';

export async function POST(req: NextRequest) {
  const { locale } = await req.json();
  (await cookies()).set('locale', locale, { path: '/' });
  return NextResponse.json({ ok: true });
}